package com.javenwong.android.engine.script;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Vector;

//一组对 话
public class Dialogues {
	public static int maxid = -1;		//初始id
	
	public int id;			//id
	public Dialogue[] dialogues;
	
	public static Dialogues read(DataInputStream in, Script script) throws IOException{
		
		Dialogues ds = new Dialogues();
		
		ds.id = in.readByte();
		
		byte count = in.readByte();
		
		ds.dialogues = new Dialogue[count];		//对话段
		
		for(byte i=0;i<count;i++){
			Dialogue d = new Dialogue();
			d.npc = script.getNpcById(in.readByte());
			d.text = in.readUTF();
				
			ds.dialogues[i]=d;
		}
		
		return ds;
	}
	
}
